module HerbariumHelper
  def validate_uri
    flash[:notice] = 'A reference is required' if connotea_uri.blank? unless content.blank?
  end
  
  # Provides a list of new plants for the sidebar.
  def new_plants
    @new_plants = Plant.recently_modified
  end
  
  # Constructs Connotea links based on the stored uri of the reference.
  def connotea_uri(uri)
    link_to("Citation", "http://www.connotea.org/uri/#{uri}") unless uri.nil?
  end
  
  # Constructs help links based on the method call.
  def help_link(term)
    link_to("?", "/wiki/pages/#{term}", { :class => "help" })
  end
  
end
